<!--
 * @Author: cgl
 * @Date: 2023-04-18 15:12:26
 * @LastEditors: cgl
 * @LastEditTime: 2023-08-28 15:53:50
 * @FilePath: \public-health-emergencies-fed:\radiation-hygiene-fe\src\views\slide\abnormal.vue
 * @Description:
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
-->
<template>
  <div class="app-container">
    <el-form
      class="searchform"
      :model="queryParams"
      ref="queryParams"
      size="small"
      label-width="100px"
      @keyup.enter.native="getList()"
    >
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="单位名称">
            <m-select
              v-model="queryParams.entrustOrganizationId"
              placeholder="输入文字检索查询"
              style="width: 100%"
              filterable
              clearable
              :lists="entrustOrganizationSelect"
              lists_label="organizationName"
              lists_value="entrustOrganizationId"
              lists_key="entrustOrganizationId"
              :total="orgTotal"
              :pageSize="10"
              @handleChange="listeningEvent"
            >
            </m-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="人员姓名">
            <el-input
              v-model="queryParams.personnelName"
              placeholder="请输入人员姓名"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="年份">
            <el-input
              v-model="queryParams.year"
              placeholder="请输入年份"
              clearable
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="批次">
            <el-input
              v-model="queryParams.batchNum"
              placeholder="请输入批次"
              clearable
            />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="6">
					<el-form-item label="寄出快递单号">
						<el-input
							v-model="queryParams.sendTrackingNumber"
							placeholder="请输入寄出快递单号"
							clearable
						/>
					</el-form-item>
        </el-col> -->
        <!-- <el-col :span="6">
					<el-form-item label="寄回快递单号">
						<el-input
							v-model="queryParams.trackingNumber"
							placeholder="请输入寄回快递单号"
							clearable
						/>
					</el-form-item>
        </el-col> -->
        <el-col :span="6">
          <el-form-item label-width="20px">
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="getList()"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="reset()"
              >重置</el-button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <el-table
      v-loading="loading"
      :data="samplingList"
      :height="height - 430 + 'px'"
      @row-dblclick="(row) => openDialog(row, '3')"
    >
      <el-table-column
        label="单位名称"
        align="center"
        prop="entrustOrganizationName"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="姓名"
        align="center"
        prop="personnelName"
        width="150"
      />
      <el-table-column
        label="剂量计编号"
        align="center"
        prop="dosageNumber"
        width="150"
      />
      <el-table-column
        label="滑片码"
        align="center"
        prop="slidesNumber"
        width="100"
      />
      <el-table-column
        label="收样日期"
        align="center"
        prop="samplingDate"
        width="120"
      />
      <el-table-column
        label="监测开始时间"
        align="center"
        prop="wearingEndTime"
        width="190"
      />
      <el-table-column
        label="监测结束时间"
        align="center"
        prop="wearingBeginTime"
        width="150"
      />
      <el-table-column label="年份" align="center" prop="year" width="150" />
      <el-table-column
        label="批次"
        align="center"
        prop="batchNum"
        width="150"
      />
      <!-- <el-table-column
        align="center"
        label="操作">
        <template slot-scope="{row}">
					<el-button
						v-if="row.state == '0'"
						@click.native.prevent="sendMessage(row)"
						type="text">
						发短信
					</el-button>
        </template>
      </el-table-column> -->
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>
<script>
import { getSamplingList } from "@/api/slides/sampling";
import { entrustOrganizationList } from "@/api/person/entrustOrganization";
import MSelect from "@/components/mSelect";

export default {
  name: "Sampling",
  dicts: ["occupational_classification", "abnormal_state"],
  components: {
    MSelect,
  },
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      total: 0,
      dialogVisible: false,
      // 视图高度
      height: document.documentElement.clientHeight,
      // 表单参数
      form: {},
      loading: false,
      status: null,
      title: null,
      // 委托单位下拉框
      entrustOrganizationSelect: [],
      // 列表
      samplingList: [],
      // 单位查询数据
      organizationQueryData: {
        organizationName: "", //单位名称模糊查询
        pageNum: 1, //页码
        pageSize: 10, //每页展示的条数
      },
      orgTotal: 0,
    };
  },
  created() {
    this.getList();
    // 获取委托单位下拉框
    // this.getEntrustOrganizationListing();
  },
  methods: {
    // 获取异常单位列表
    getList() {
      this.loading = true;
      getSamplingList(this.queryParams)
        .then((response) => {
          this.samplingList = response.rows;
          this.total = response.total;
          this.loading = false;
        })
        .catch((response) => {
          this.loading = false;
        });
    },
    // 获取单位下拉框
    listeningEvent(e) {
      let { queryName, pageNum, pageSize, type } = e;
      if (type == "scroll" && pageNum == this.organizationQueryData.pageNum)
        return;
      this.organizationQueryData.organizationName = queryName;
      this.organizationQueryData.pageNum = pageNum;
      this.organizationQueryData.pageSize = pageSize;
      entrustOrganizationList(this.organizationQueryData).then((response) => {
        if (type == "scroll") {
          this.entrustOrganizationSelect.push(...response.rows);
        } else {
          this.entrustOrganizationSelect = response.rows;
        }
        this.orgTotal = response.total;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.operation {
  margin-bottom: 15px;
  .register {
    padding-inline: 30px;
  }
}
.uploadbutton {
  padding-inline: 20px;
}
.myupload {
  margin-bottom: 20px;
}
.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  .calc {
    width: min-content;
    margin-left: 20px;
    .el-button {
      margin: 0;
      &:nth-of-type(1) {
        margin-bottom: 10px;
      }
    }
  }
}
.nametitle {
  text-align: center;
  margin-bottom: 10px;
  font-weight: bolder;
  &::before {
    content: "* ";
    color: red;
  }
}
.el-table .warning-row {
  background: rgb(228, 13, 13);
}
.searchcontainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -10px;
}
.viewform {
  justify-content: flex-end;
}
.title {
  padding-left: 10px;
  border-left: 5px solid #2a72ee;
  text-align: left;
  font-weight: bolder;
  font-size: 16px;
  margin-bottom: 30px;
}
.viewfile {
  color: #2a72ee;
  cursor: pointer;
  margin-right: 10px;
  width: fit-content;
  &:hover {
    color: #2a72ee;
    text-decoration: underline;
  }
  &.noline {
    width: auto;
  }
  &.noline:hover {
    text-decoration: none;
  }
}
.selectLiterform ::v-deep .el-form {
  margin-left: -55px;
}
.notionalDoseinput {
  width: 70%;
}
.detailtable {
  margin-bottom: 50px;
}
.notionaltable {
  ::v-deep .el-table__cell {
    padding: 0;
  }
}
.detailpagination {
  margin-bottom: 20px;
}
.lostFileLabel {
  margin-bottom: 10px;
  padding-left: 12px;
  .label {
    font-size: 14px;
    color: #606266;
    font-weight: 700;
  }
}
</style>
